<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/view/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
	
	<title>Insert title here</title>
	<link href="${project}/ds/css/input.css" rel="stylesheet"/>
	<link href="${project}/ds/css/roomStyle.css" rel="stylesheet"/>
	<link href="${project}/ds/lib/layui/css/layui.css" rel="stylesheet"/>
	<link href="${project}/ds/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet"/>
	<link href="${project}/ds/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
	<link href="${project}/ds/lib/ligerUI/skins/Gray2014/css/all.css" rel="stylesheet"/>
	<link href="${project}/ds/css/popup.css" rel="stylesheet" />
	
	<script src="${project}/ds/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
	<script src="${project}/ds/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
	<script src="${project}/ds/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
	<script src="${project}/ds/lib/jquery.form.js" type="text/javascript"></script>
	<script src="${project}/ds/js/XHD.js" type="text/javascript"></script>
	<script src="${project}/ds/js/base64.js" type="text/javascript"></script>
	<script src="${project}/ds/lib/layui/layui.js" type="text/javascript"></script>
	<script src="${project}/ds/js/js/ws.js" type="text/javascript"></script>
	<%--<script src="${project}/ds/js/md5.js" type="text/javascript"></script>--%>
	<script src="${project}/ds/js/pupop.js" type="text/javascript"></script>
	<script src="${project}/ds/js/js/ws.js" type="text/javascript"></script>
	<script src="${project}/ds/js/websocked.js" type="text/javascript"></script>
	<script src="${project}/ds/js/room/curd.js" type="text/javascript"></script>
	<script src="${project}/ds/js/room/command.js" type="text/javascript"></script>
	<script src="${project}/ds/js/layeralert.js" type="text/javascript"></script>
<script type="text/javascript">
    var manager;
    var readIDCard = true; //读卡标识
    var telexist = true;
    var clientexist = true;
    var clientid = -1;
    var CONTEXT_PATH = "http://" + document.location.host;
    var user = getCookie("xhdcrm_uid");
    var layer;
    var element;
    var loadindex = 0;
    var fromtype;

    layui.use(['upload', 'layer'],
        function () {
            layer = layui.layer;
        });

    function _key() {
        if (event.keyCode == 13) {
            save();
        }
    }

    $(function () {


       /*  $.ajax({
            type: "GET",
            url: "../data/Tuser.ashx", // 注意后面的名字对应CS的方法名称 
            data: { Action: 'GetFromType' }, // 注意参数的格式和名称 
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: false,
            success: function (result) {
                fromtype = result;
            }
        }); */
        //主购人数
        $("#tree1")
            .ligerTree({
                data: [
                    { id: "main", icon: '${project}/ds/images/Icon/38.png', text: "购买人" },
                    { id: "help", icon: '${project}/ds/images/Icon/37.png', text: "关联人" }
                ],
                idFieldName: 'id',
                nodeWidth: 300,
                usericon: 'd_icon',
                checkbox: false,
                itemopen: false
            });

       // websocketConnect();
        //        $("#form1").ligerForm();
        manager = $("#maingrid4")
            .ligerGrid({
                columns: [
                    {
                        display: '序号',
                        width: 50,
                        render: function (rowData, rowindex) {
                            return rowindex + 1;
                        }
                    },
                    { display: "姓名", name: "D_Name", width: 60 },
                    { display: "性别", name: "D_Sex", width: 40 },
                    { display: "手机", name: "D_Tel", width: 110 },
                    { display: "身份证", name: "D_Card", width: 160 },
                    { display: "地址", name: "D_Address", width: 150 },
                    //{ display: "置业顾问", name: "D_Saller", width: 80 },
                    //{ display: "置业顾问手机", name: "D_SallerTel", width: 110 },
                    //{ display: "代理机构", name: "D_Proxy", width: 110 },
                    { display: "关联人", name: "D_GName", width: 60 },
                    { display: "关联人身份证", name: "D_GCardNo", width: 160 },
                    { display: "关联人手机", name: "D_GTel", width: 110 },
                    //{
                    //    display: "认筹数", name: "D_FromCount", width: 80,
                    //    render: function (rowdata) {
                    //        var html = "<a href='javascript:void(0);' ";
                    //        html += " onclick='ShowTipHelper(this," + rowdata["D_ID"] + ")'>";
                    //        html += rowdata["D_FromCount"];
                    //        html += "</a>";
                    //        return html;
                    //    }
                    //},
                    //{ display: "认筹类型", name: "D_FromType", width: 80 },
                    //{ display: "登录批次", name: "D_LoginId", width: 60 },
                    { display: "登记时间", format: "yyyy-MM-dd", name: "D_OperationDate", width: 160 },
                    { display: "操作员", name: "D_OperationName", width: 80 }
                ],
                dataAction: "server",
                sortName: "D_ID",
                sortOrder: "desc",
                pageSize: 50,
                rowHeight: 22,
                pageSizeOptions: [20, 30, 50, 100],
                url: "/customerTwo/getGrid",
                width: '100%',
                height: '100%',
                pagerRender: function () {

                    var html = [];
                    html.push('<div style="line-height:32px;padding-right:10px;float:right;">');
                    html.push('</div>');
                    return html.join('');
                }
                //                url: "../data/Tuser.ashx?Action=grid",
                //                width: '100%',
                //                height: '100%',
                //                heightDiff: -1
            });

        $("#phone")
            .change(function () {
                var tel = $.trim($(this).val());
                if (tel.length !== 11) {
                    layer.msg("手机号码必须11位！", function () { });
                    //top.$.ligerDialog.warn("手机号码必须11位！");
                } else {
                    validateTel($(this).val());
                }
            });
        $("#ccard")
            .change(function () {
                var tel = $.trim($(this).val());
                if (tel.length !== 18) {
                    layer.msg("身份证号码必须18位！", function () { });
                    //top.$.ligerDialog.warn("身份证号码必须18位！");
                } else {
                    valitedClient($(this).val());
                }
            });
        $("#saller").click(function () {
            var offset = $(this).offset();
            layer.open({
                type: 1,
                content: $("#sallerdiv"),
                skin: 'layui-layer-nobg',
                closeBtn: false,
                shade: [0.1, "#000"],
                shadeClose: true,
                title: "置业顾问",
                offset: [(offset.top + 20), offset.left],
                end: function () {
                    $("#sallerdiv").hide();
                }
            });
        });
        $("#D_FormCount").click(function () {
            var offset = $(this).offset();
            layer.open({
                type: 1,
                content: $("#formcountdiv"),
                skin: 'layui-layer-nobg',
                closeBtn: false,
                shade: [0.1, "#000"],
                shadeClose: true,
                title: "认筹数",
                offset: [(offset.top + 20), offset.left],
                end: function () {
                    $("#formcountdiv").hide();
                }
            });
        });
        $("#D_FromType").click(function () {
            var offset = $(this).offset();
            layer.open({
                type: 1,
                content: $("#formtypediv"),
                skin: 'layui-layer-nobg',
                closeBtn: false,
                shade: [0.1, "#000"],
                shadeClose: true,
                title: "认筹类型",
                offset: [(offset.top + 20), offset.left],
                end: function () {
                    $("#formtypediv").hide();
                }
            });
        });
        $("#D_FormCount").text("1");
        $("#D_FromType").text(fromtype.length > 0 ? fromtype[0] : "20000");
        //        $("#saller").ligerComboBox({
        //            url: "../data/Saller.ashx?Action=tree",
        //            selectBoxWidth: 120
        //        });
        //刷卡
        connectWB(); //连接websocket
        LoadCustom();
        initLayout();
        $(window)
            .resize(function () {
                initLayout();
            });
    });

    function LoadCustom() {
        $.ajax({
            url: "../data/Saller.ashx",
            type: "post",
            dataType: "json",
            data: { Action: "grid" },
            success: function (data) {
                data = data.Rows;
                for (var i in data) {
                    if (data.hasOwnProperty(i)) {
                        var saller = data[i].D_Name;
                        var id = data[i].D_ID;
                        var str = "<div onclick=\"SetSaller('" +
                            saller +
                            "', " + id + ")\" class=\"layui-btn\">" +
                            saller +
                            "</div>";
                        $("#sallerdiv").append(str);
                    }
                }
            }
        });
        $.ajax({
            url: "../data/Dictionary.ashx",
            type: "post",
            dataType: "json",
            data: { Action: "getDetail", type: "apply", field: "formcount" },
            success: function (data) {
                data = data.Rows;
                for (var i in data) {
                    if (data.hasOwnProperty(i)) {
                        var formcount = data[i].D_Text;
                        var str = "<div onclick=\"SetFormCount('" +
                            formcount +
                            "')\" class=\"layui-btn\">" +
                            formcount +
                            "</div>";
                        $("#formcountdiv").append(str);
                    }
                }
            }
        });
        $.ajax({
            url: "../data/Dictionary.ashx",
            type: "post",
            dataType: "json",
            data: { Action: "getDetail", type: "apply", field: "formtype" },
            success: function (data) {
                data = data.Rows;
                for (var i in data) {
                    if (data.hasOwnProperty(i)) {
                        var formtype = data[i].D_Text;
                        var str = "<div onclick=\"SetFormType('" +
                            formtype +
                            "')\" class=\"layui-btn\">" +
                            formtype +
                            "</div>";
                        $("#formtypediv").append(str);
                    }
                }
            }
        });
    }

    function ShowTipHelper(g, id) {
        $.ajax({
            url: "../data/Tuser.ashx",
            type: "post",
            async: false,
            data: { Action: "gethelper", parentid: id },
            dataType: "json",
            success: function (data) {
                var html = "";
                for (var i in data) {
                    if (data.hasOwnProperty(i)) {
                        var help = data[i];
                        html += help.D_Name + "  手机：" + help.D_Tel + "<br/>";
                        html += "身份证：" + help.D_CardNo + "<br/>";
                    }
                }
                if (html !== "") {
                    layer.tips(html,
                        $(g),
                        {
                            tips: [2, "#3595CC"],
                            time: 2000
                        });
                } else {
                    layer.tips("该客户没有关联人",
                        $(g),
                        {
                            tips: [2, "#3595CC"],
                            time: 1000
                        });
                }
            }
        });
    }

    function addLink() {
        if (clientid < 0) {
            layer.msg("请先刷购买人身份证！", function () { });
            return;
        }
        top.$.ligerDialog.open({
            title: "新增关联人",
            height: 300,
            width: 530,
            url: "../Car/Link.aspx",
            buttons: [
                {
                    text: "确认",
                    onclick: function (item, dialog) {
                        var obj = dialog.frame.f_GetCard();
                        console.log(obj);
                        if (obj) {
                            dialog.close();
                            connectWB(); //连接websocket
                            $.ajax({
                                url: "../data/Tuser.ashx",
                                type: "post",
                                data: {
                                    Action: "AddHelper",
                                    clientid: clientid,
                                    name: obj.Name,
                                    cardno: obj.IDCardNo,
                                    sex: obj.Sex,
                                    phone: obj.Phone
                                },
                                dataType: "json",
                                success: function(data) {
                                    var result = data.result;
                                    if (result === "true") {
                                        var tels = new Array();
                                        tels[0] = $("#Tel").val();
                                        var json = wsorder.mobileUserUpdate(user, JSON.stringify(tels), JSON.stringify({ D_GName: obj.Name, D_GCardNo: obj.IDCardNo, D_GTel: obj.Phone }));
                                        websocket.send(JSON.stringify(json));
                                        //layermsg("新增关联人成功！");
                                        //f_reload();
                                        //                                    AddBuyer("help", obj.Name, obj.IDCardNo + "   手机：" + obj.Phone);
                                    } else {
                                        layer.msg(data.msg, function() {});
                                    }
                                }
                            });
                        } else {
                            layer.msg("请刷卡");
                        }
                    }
                },
                {
                    text: '取消',
                    onclick: function (item, dialog) {
                        connectWB(); //连接websocket
                        dialog.close();
                    }
                }
            ]
        });
    }

    function showIDCardData(data) {
        resetdata();
        var readdata = data.data;

        $("#headimg").attr("src", "data:image/gif;base64," + readdata.pic);
        $("#cname").val(readdata.name);
        console.log(readdata.sex);
        $("input[name=D_Sex][type=radio][value=" + readdata.sex + "]").attr("checked", "true");

        $("#cborn").html(readdata.birthday);
        $("#ccard").val(readdata.card);
        $("#cadd").html(readdata.address);

        valitedClient(readdata.card);
    }

    function valitedClient(idCard) {
        if ($("#divexist").length > 0) {
            $("#divexist").remove();
        }
        $.ajax({
            url: "/customerTwo/validateIdCardCustomerTwo",
            type: "post",
            async: false,
            data: { card: idCard },
            dataType: "json",
            success: function (data) {
                var result = data.result;
                if (result === "false") {
	                var json = {};
	                if (data.json) {
	                    json = data.json;
	                    for (var n in json) {
	                        if (json.hasOwnProperty(n)) {
	                            if (json[n] === "null" || json[n] === null) 
	                                json[n] = "";
	                        }
	                    }
	                }
                    showError(data.msg);
                    clientid = json.D_ID;
                    $("#Tel").val(json.D_Tel);
                    $("#phone").val(json.D_GTel);
                    AddBuyer("main", json.D_Name, json.D_Card);
                    //ShowHelper(clientid);
                    search(json.D_Tel);
                }/*  else if (result === "exist") {
                    showError(data.msg);
                    clientid = json.D_ID;
                    $("#Tel").val(json.D_Tel);
                    $("#phone").val(json.D_Tel);
                    AddBuyer("main", $("#cname").val(), $("#ccard").val());
                    ShowHelper(clientid);
                    search(json.D_Tel);
                }  */else {
                    clientexist = false;
                    clientid = -1;
                    $("#phone").focus();
                }
            }
        });
    }

    //加载关联人
    function ShowHelper(id) {
        $.ajax({
            url: "../data/Tuser.ashx",
            type: "post",
            async: false,
            data: { Action: "gethelper", parentid: id },
            dataType: "json",
            success: function (data) {
                for (var i in data) {
                    if (data.hasOwnProperty(i)) {
                        var help = data[i];
                        AddBuyer("help", help.D_Name, help.D_CardNo);
                    }
                }
            }
        });
    }

    function showError(msg) {
        var exist = $("<div></div>");
        exist.attr("id", "divexist");
        exist.css("position", "absolute");
        exist.css("top", "70px");
        exist.css("left", "180px");
        exist.css("color", "red");
        exist.html(msg);
        $("body").append(exist);
    }
	//判断电话是否有重复
    function validateTel(tel) {
        if ($("#divexist").length > 0) {
            $("#divexist").remove();
        }
        $.ajax({
            url: "/customerTwo/validateTelCustomerTwo",
            type: "post",
            data: { tel: tel },
            dataType: "json",
            success: function (data) {
                var result = data.result;
                if (result === "false") {
                    showError(data.msg);
                } else if (result === "true") {
                    telexist = false;
                }
            }
        });
    }

    function save() {
        valitedClient($("#ccard").val());
        validateTel($("#phone").val()); 
        var msg = "";
        var result = false;
        if (clientid !== -1) {
            msg = "客户已存在！!";
        } else if ($("#phone").val() === "") {
            msg = "请输入手机号码!";
        } else if ($.trim($("#phone").val()).length !== 11) {
            msg = "请输入正确的11位手机号码!";
        } else if ($("#ccard").val().length !== 18) {
            msg = "请填定18位身份证号码!";
        } else if (clientexist) {
            msg = "客户身份证重复！";
        } else if (!$(".csex").is(":checked")) {
            msg = "性别必选!";
        } else if ($.trim($("#phone").val()).length === 11 && telexist) {
            msg = "手机号码重复！";
        } /* else if ($("#D_FormCount").text() === "" || $("#D_FormCount").text().indexOf("请选择") !== -1) {
            msg = "认筹数不能为空！";
        } else if ($("#D_FromType").text() === "" || $("#D_FromType").text().indexOf("请选择") !== -1) {
            msg = "认筹类型不能为空！";
        }  */else {
            result = true;
        }
        if (!result) {
            //top.$.ligerDialog.close();
            layer.msg(msg);
            return;
        }
        //新增客户时同保存问题并记录来访
        SaveClientInformation();
    }

    function SaveClientInformation() {
        loadindex = layload("保存中");
        var issave = getissave();
        console.log(issave);
        if (issave) {
            $.ajax({
                url: "/customerTwo/saveCustomerTwo",
                type: "post",
                data: {json:issave},
                dataType: "json",
                success: function (result) {
                    if (result.result === "true") {
                    	layer.close(loadindex);
                    	 f_reload();
                        //wsuseradd(user, $("#phone").val());
                    } else if (result.result === "false") {
                        closewait();
                        clientid = 0;
                        layer.msg(result.msg);
                        //layer.msg(result.msg, function () { });
                        //top.$.ligerDialog.warn(result.msg);
                    }
                }
            });
        }
    }

    //发送新增消息
    function wsuseradd(user, tel) {
        var json = wsorder.useradd(user, tel);
        websocket.send(JSON.stringify(json));
    }

    //发送删除消息
    function wsuserdel(user, tel) {
        var json = wsorder.userdel(user, tel);
        websocket.send(JSON.stringify(json));
    }

    //ws新增成功回复
    function wsuseraddreply() {
        f_reload();
        closewait();
    }

    //ws删除成功回复
    function wsuserdelreply() {
        manager.loadData(true);
        f_reload();
        closewait();
    }
    
    //ws加载成功回复
    function wsuseraddlinkreply() {
        layermsg("新增关联人成功！");
        f_reload();
        //manager.loadData(true);
        //closewait();
    }

    function closewait() {
        layer.close(loadindex);
    }

    function AddBuyer(level, name, cardno) {
        //新增购买人
        $("#tree1").ligerGetTreeManager().selectNode(level);
        var a = $("#tree1").ligerGetTreeManager().getSelected();
        $("#tree1")
            .ligerGetTreeManager()
            .append(a.target,
            [
                {
                    id: level + 'buy',
                    d_icon: '../images/icon/37.png',
                    text: name + "  身份证：" + cardno
                }
            ]);
    }

    //查询
    function dosearch() {
        var nametel = $.trim($("#nametel").val());
        var parms = [];
        if (nametel !== "") {
            parms = [{
                op: 'like',
                field: 'D_Name',
                value: nametel,
                type: 'string'
            },
            {
                op: 'like',
                field: 'D_Tel',
                value: nametel,
                type: 'string'
            }
            ];
        }
        var initParams = { op: "or", rules: parms };
		console.log(JSON.stringify(initParams));
       // manager.options.parms = [{ name: 'where', value: JSON.stringify(initParams) }];
        manager.options.parms = [{ name: 'where', value: nametel }];

        manager.loadData();
    }

    function search(tel) {
        var nametel = $.trim(tel);
        var parms = [];
        if (nametel !== "") {
            parms = [{
                    op: 'like',
                    field: 'D_Name',
                    value: nametel,
                    type: 'string'
                },
                {
                    op: 'like',
                    field: 'D_Tel',
                    value: nametel,
                    type: 'string'
                }
            ];
        }
        var initParams = { op: "or", rules: parms };

       // manager.options.parms = [{ name: 'where', value: JSON.stringify(initParams) }];
        manager.options.parms = [{ name: 'where', value: nametel }];
        manager.loadData();
    }

    //下载客户导入模版
    function LoadModel() {
        var form = $("<form>"); //定义一个form表单
        form.attr("style", "display:none");
        form.attr("target", "");
        form.attr("method", "post");
        form.attr("action", "../data/Room.ashx");

        var input1 = $("<input>");
        input1.attr("type", "hidden");
        input1.attr("name", "Action");
        input1.attr("value", "loadFile");

        var input2 = $("<input>");
        input2.attr("type", "hidden");
        input2.attr("name", "type");
        input2.attr("value", "client");

        $("body").append(form); //将表单放置在web中
        form.append(input1);
        form.append(input2);
        form.submit(); //表单提交
    }

    function del() {
        var row = manager.getSelectedRow();
        if (row) {
            layer.confirm('是否确认删除客户？'
                , function (index) {
                    layer.close(index);
                    layer.confirm('是否确认删除客户' + row.D_Name + '？'
                        , function (index) {
                            layer.close(index);
                            var tel = row.D_Tel;
                            delUser(tel);
                            loadindex = layload("客户删除中");
                        });
                });
        } else {
            layer.msg("请选择行", function () { });
        }
    }
    function delUser(tel){
		 $.ajax({
            url: "/customerOne/deleteCustomerTwo",
            type: "post",
            data: "tel="+tel,
            dataType: "json",
            success: function(result) {
                if (result.result === "true") {
               	 layer.close(loadindex);
               	 f_reload();
                  layer.msg("删除成功");
                }
            }
        });
	}
    function getissave() {
        var birthday = $("#cborn").text().replace('年', '-').replace('月', '-').replace('日', '');
        var result = {
           // Action: "save",
            cname: $.trim($("#cname").val()),
            ccard: $("#ccard").val(),
            csex: $(".csex:checked").val(),
            cborn: birthday,
            cadd: $.trim($("#cadd").text()),
            tel: $.trim($("#phone").val()),
            sallid: $("#sallid").val() === "" ? "0" : $("#sallid").val(),
            D_FormCount: $("#D_FormCount").text().indexOf("请选择") !== -1 ? "1" : $("#D_FormCount").text(),
            D_FromType: $("#D_FromType").text().indexOf("请选择") !== -1 ? "" : $("#D_FromType").text()
        };
        return JSON.stringify(result);
    }

    function f_reload() {
        manager.loadData(true);
        resetdata();

        if ($("#divexist").length > 0) {
            $("#divexist").remove();
        }
    };

    function resetdata() {
        $("#tree1").ligerGetTreeManager().clear();
        $("#tree1").ligerGetTreeManager().data = [];
        $("#tree1").ligerGetTreeManager().append(null, [{ id: "main", icon: '/project/ds/images/Icon/38.png', text: "主购人" }]);
        $("#tree1").ligerGetTreeManager().append(null, [{ id: "help", icon: '/project/ds/images/Icon/37.png', text: "关联人" }]);

        clientid = -1;
        telexist = true;
        clientexist = true;
        //重置刷卡数据
        $("#phone").val(""); //重置号码
        $("#D_Phone").val(""); //重置手机号码2
        $("#D_CAddress").val(""); //重置地址
       // $("#headimg").attr("src", "../upload/white.png");
        $("#cname").val("");
        $("input[name=D_Sex]").attr("checked", false);
        $("#cborn").html("");
        $("#bornh").val("");
        $("#ccard").val("");
        $("#ccard").val("");
        $("#saller").html("请选择");
        //        $("#sallid").val("");
        //        $("#D_FormCount").html("请选择");
        //        $("#D_FromType").html("请选择");
        //        $("#cadd").html("");
        $("#cadd").html("");
    }

    var CONTEXT_PATH = "http://" + document.location.host;

    function SetSaller(val, id) {
        $("#saller").html(val);
        $("#sallid").val(id);
        layer.closeAll();
    }
    function SetFormCount(val) {
        $("#D_FormCount").html(val);
        layer.closeAll();
    }

    function SetFormType(val) {
        $("#D_FromType").html(val);
        layer.closeAll();
    }

</script>
<style type="text/css">
    form{height:auto; width:auto;}
</style>
</head>
<body onkeydown="_key()">
<div class="clearfix" style="width:100%; height:100%;">
    <div id="toolbar" style="padding:10px;">
        <div class="layui-btn" onclick="save()">保存</div>
        <div class="layui-btn-group">
            <div class="layui-btn" onclick="del()">删除</div>
            <div class="layui-btn" onclick="addLink()">新增关联人</div>
        </div>
        <div class="layui-inline" style="display:none;">
            <input type="file" id="ImportFile" name="ImportFile" lay-ext="xls|xlsx" class="layui-upload-file"/>
        </div>
        <div class="layui-input-inline">
            <input type="text" id="nametel" name="nametel" placeholder="姓名/手机" class="layui-input">
        </div>
        <div class="layui-btn" onclick="dosearch()">查询</div>
    </div>
    <div style="height: 100%; width: 100%;">
        <div id="left" style="position: fixed; top: 58px; left:0; bottom:0; overflow: auto; width: 527px; border-right:1px solid #ccc;border-top:1px solid #ccc;">
            <div id="idcard">
                <ul>
                    <li class="liName">
                        <input type="text" onchange="javascript:if(!/^[\u4e00-\u9fa5]+$/gi.test(this.value))alert('姓名只能是汉字');" id="cname" name="cname" />
                    </li>
                    <li class="liSex">
                        <input id="sexM" type="radio" class="csex" name="D_Sex" value="男" /><span for="sexM">男</span><input id="sexW" type="radio" class="csex" name="D_Sex" value="女"><span for="sexW">女</span>
                    </li>
                    <li class="liBorn">
                        <label id="cborn"></label>
                    </li>
                    <li class="liCadd">
                        <label id="cadd"></label>
                    </li>
                    <li class="liCard">
                        <input type="text" id="ccard" name="ccard" maxlength="18" />
                    </li>
                </ul>
                <div class="headimg"><img id="headimg" onerror="this.setAttribute('src', '../upload/white.png')"></div>
            </div>
            <hr class="hr1" />
            <div class="info clearfix">
                <input type="hidden" id="D_CAddress" name="D_CAddress" />
                <ul>
                    <li class="liFirst">手机：</li>
                    <li class="liPhone1"><input type="text" id="phone" name="phone" onkeyup="value = value.replace(/[^\d]/g, '')" maxlength="11" /></li>
                    <li style="display: none;"><input type="text" id="Tel" name="Tel" /></li>
                    <li style="display: none;" class="liSecond" id="consultant">置业顾问：</li>
                    <li style="display: none;" class="liPhone2"><div id="saller" class="liger-button">请选择</div><input type="hidden" id="sallid" /></li>
                    <li style="display: none;" class="liFirst">认筹数：</li>
                    <li style="display: none;" class="liPhone1"><div id="D_FormCount" class="liger-button">请选择</div></li>
                    <li style="display: none;" class="liSecond">认筹类型：</li>
                    <li style="display: none;" class="liPhone2"><div id="D_FromType" class="liger-button">请选择</div></li>
                </ul>
            </div>
            <hr class="hr1" />
            <div id="buylist" style="width:100%; margin: 0 auto;">
                <div id="mainbuy"></div>
                <div id="helpbuy"></div>
                <ul id="tree1"></ul>
            </div>
        </div>
        <div style="left: 528px; height: 100%; position: fixed; right:0;">
            <div id="maingrid4" style="margin: -1px;"></div>
        </div>
    </div>
</div>
<div id="sallerdiv" style="display:none; text-align: center; padding:10px;">
</div>
<div id="formcountdiv" style="display:none; text-align: center; padding:10px;">
</div>

<div id="formtypediv" style="display:none; text-align: center; padding:10px;">
</div>
</body>
</html>